<?php
class PerformanceMetricsPrograms extends HTech_Db_Table
{
    protected $_name    = 'view_performance_metrics_programs';
    protected $_primary = 'PerformanceMetricCustomId';  
    
    protected function _setGridMetadata()
    {
        $this->_gridMetadata['title'] = $this->translate("Performance metrics");
        $this->_gridMetadata['titleMods'] = array('Code','Program');
        $this->_gridMetadata['onClick'] = 'admin.performance-metric-program.add';
        $this->_gridMetadata['params'] = array('ProgramId');
        $this->_gridMetadata['headers'] = array
            (
                array('PerformanceMetricCustomId',               50, $this->translate("Id"),           'Number'),
                array('Metric',             180, $this->translate("Metric"),       'String'),
                array('Program',            180, $this->translate("Program"),      'String'),
                array('A',                  100, $this->translate("Custom A"),     'Number',   'Standard'),
                array('DefaultMarkA',       180, $this->translate("Default A"),    'Number',   'Standard'),
                array('B',                  100, $this->translate("Custom B"),     'Number',   'Standard'),
                array('DefaultMarkB',       180, $this->translate("Default B"),    'Number',   'Standard'),
                array('C',                  100, $this->translate("Custom C"),     'Number',   'Standard'),
                array('DefaultMarkC',       180, $this->translate("Default C"),    'Number',   'Standard')
            );
        return $this;
    }
    
    static function getMetricOptions()
    {
        return array('' => '--- ' . self::translate('Select metric')) + 
                Zend_Registry::get('db')->fetchPairs("select PerformanceMetricId, Metric 
                    from performance_metrics where Subject = 'Program' and Metric != 'Score' order by Metric");
    }
}